﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace PlaylistParity
{
    public class Playlist : BaseModel
    {
        /// <summary>
        /// The <see cref="Name" /> property's name.
        /// </summary>
        public const string NamePropertyName = "Name";

        private string _name = string.Empty;

        /// <summary>
        /// Gets the Name property.
        /// TODO Update documentation:
        /// Changes to that property's value raise the PropertyChanged event. 
        /// This property's value is broadcasted by the Messenger's default instance when it changes.
        /// </summary>
        public string Name
        {
            get
            {
                return _name;
            }

            set
            {
                if (_name == value)
                {
                    return;
                }

                var oldValue = _name;
                _name = value;

                // Update bindings, no broadcast
                RaisePropertyChanged(NamePropertyName);

            }
        }

        /// <summary>
        /// The <see cref="SongList" /> property's name.
        /// </summary>
        public const string SongListPropertyName = "SongList";

        private ObservableCollection<Song> _songList = new ObservableCollection<Song>();

        /// <summary>
        /// Gets the SongList property.
        /// TODO Update documentation:
        /// Changes to that property's value raise the PropertyChanged event. 
        /// This property's value is broadcasted by the Messenger's default instance when it changes.
        /// </summary>
        public ObservableCollection<Song> SongList
        {
            get
            {
                return _songList;
            }

            set
            {
                if (_songList == value)
                {
                    return;
                }

                var oldValue = _songList;
                _songList = value;

                // Update bindings, no broadcast
                RaisePropertyChanged(SongListPropertyName);
            }
        }
    }
}
